import 'dart:convert' show json;

T asT<T>(dynamic value) {
  if (value is T) {
    return value;
  }
  return null;
}

class Like {
  Like({
    this.id,
    this.like_num,
  });

  factory Like.fromJson(Map<String, dynamic> jsonRes) => jsonRes == null
      ? null
      : Like(
    id: asT<int>(jsonRes['id']),
    like_num: asT<int>(jsonRes['like_num']),
  );

  int id;
  int like_num;

  Map<String, dynamic> toJson() => <String, dynamic>{
    'id': id,
    'like_num': like_num,
  };
  @override
  String toString() {
    return json.encode(this);
  }
}